using System;
using System.Collections.Generic;
using System.Text;
using Cores;
using DAOLayer;
using System.Data;

namespace BUSLayer
{
    public class PhimBus
    {
        private PhimDao _phimDAO;

        public PhimDao PhimDAO
        {
            get { return _phimDAO; }
            set { _phimDAO = value; }
        }

        public PhimBus()
        {
            PhimDAO = new PhimDao();
        }

        ~PhimBus()
        { }

        public DataTable LayThongTinPhim(int maso)
        {
            PhimDAO.Conn.Connect();
            return PhimDAO.LayThongTinPhim(maso);
        }

        public DataTable LayDsDienVienTrongPhim(int maso)
        {
            PhimDAO.Conn.Connect();
            return PhimDAO.LayDsDienVienTrongPhim(maso);
        }

        public DataTable LayDsDaoDienTrongPhim(int maso)
        {
            PhimDAO.Conn.Connect();
            return PhimDAO.LayDsDaoDienTrongPhim(maso);
        }
        public DataTable DSPhimTheoDV(string TenDV)
        {
            return PhimDAO.DanhSachPhimTheoDienVien(TenDV);
        }

        public DataTable LayDSPhim()
        {

            DateTime dt = DateTime.Now;
            DayOfWeek firstday = DayOfWeek.Monday;
            DayOfWeek today = dt.DayOfWeek;

            int Fdiff = 0;

            if (today == DayOfWeek.Sunday)
                Fdiff = 6;
            else
                Fdiff = today - firstday;
            DateTime NgayDT = dt.AddDays(-Fdiff);

            PhimDAO = new PhimDao();

            return PhimDAO.LayDSPhim(NgayDT);


        }
    }

}
